package cn.just.food.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.just.food.dao.UserDao;
import cn.just.food.entity.User;

public class addUserServlet extends HttpServlet{
	protected void service(HttpServletRequest request,HttpServletResponse response)throws ServletException, IOException{
		request.setCharacterEncoding("utf-8");
		
		String nickname = request.getParameter("name");
		String phone = request.getParameter("phone");
		String pwd = request.getParameter("pwd");
		
		User user = new User();
		user.setNickname(nickname);
		user.setPhone(phone);
		user.setPwd(pwd);
		UserDao dao = new UserDao();
		dao.addUser(user);
		
		response.sendRedirect("login");
	}

}
